import re

arr=input().split()
reg=input()

def getResult():
    # c=re.compile(f"^{reg}$")
    c=re.compile(pattern=f"^{reg}$")
    ans=[]
    for i in range(0,len(arr)):
        if c.match(arr[i]):
            ans.append(i)
    if len(ans)==0:
        return -1
    else:
        return ",".join(map(str,ans))
print(getResult())
